/********************************************************************
	TABAL ENGINE - 2012/10/30
	author:		Marc Cuscullola
	
	purpose:	Defines the singleton pattern
*********************************************************************/
#pragma once

#ifndef __UTILITIES__SINGLETON__INCLUDED_H__
#define __UTILITIES__SINGLETON__INCLUDED_H__

#include <assert.h>

template <typename T>
class CSingleton
{
public:
	CSingleton();
	virtual ~CSingleton();

	static T& GetSingleton()
	{
		assert(m_pSingleton);  
		return (*m_pSingleton);
	}

	static T* GetSingletonPtr()
	{
		assert(m_pSingleton);
		return m_pSingleton;
	}

protected:
	static T* m_pSingleton;
};

template<typename T> T* CSingleton<T>::m_pSingleton = 0;

#include "Singleton.inl"

#endif //__UTILITIES__SINGLETON__INCLUDED_H__
